<?php

class Renew_Model_BukkenList extends Apm_Model_Base
{

    public function getCountForArea($prefCds, $cityCds, $chous, $from, $where, $dbParams, $picture_list)
    {
        // ★★★都道府県
        $preflst = split(" , ", $prefCds);
        $prefVal = [];
        foreach ($preflst as $pref)
        {
            $val = $dbParams[$pref];
            if (!in_array($val, $prefLst))
            {
                $prefVal[] = $val;
            }
            unset($dbParams[$pref]);
        }
        $prefs = "'" . join("','", $prefVal) . "'";
        // ★★★都道府県

        // ★★★市区
        $citylst = split(" , ", $cityCds);
        $cityVal = [];
        foreach ($citylst as $city)
        {
            $val = $dbParams[$city];
            if (!in_array($val, $cityVal))
            {
                $cityVal[] = $val;
            }
            unset($dbParams[$city]);
        }
        $cities = "'" . join("','", $cityVal) . "'";
        // ★★★市区

        $notWhere = 'AND EXISTS (SELECT 1 FROM M05TENPO_INFO M05 WHERE T03.T03_TENPO_CD = M05.M05_TENPO_CD AND M05.M05_KOUKAI_FLAG = 1)';
        $col = $picture_list ? "T03.T03_HEYA_CD" : "distinct T03.T03_DAIHYO_TATEMONO_CD";
        $whr = $picture_list ? " " : " and T03.T03_DAIHYO_FLG = 1 ";
        $sql = " select  count($col) as tatemono_count ";
        $sql .= " from	T03WEB_HEYA T03 " . $from . "
			where	T03.T03_TODOUFUKEN_CD	IN (" . $prefs . ")";

        if (!isset($from) || empty($from)) $from = '';

        // 町条件があれば→カウント
        if (isset($chous) && sizeof($chous) > 0)
        {

            // 単独市区町村がある場合
            if ($cityCds != '')
            {

                $sql .= " AND (";

                $sql .= " T03.T03_SHIKUCHOUSON_CD	IN (" . $cities . ")";
                $sql .= " OR T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";

                $sql .= ") ";
            }
            else
            {
                $sql .= " AND  T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";
            }
        }
        else
        { // 町条件がない
            $sql .= " and T03.T03_SHIKUCHOUSON_CD	IN (" . $cities . ")";
        }

        $sql .= $whr . $where;

        // 条件カウントの場合→物件単位
        if (isset($dbParams['favirote']) && $dbParams['favirote'])
        {
            unset($dbParams['favirote']);
            $sql = "
			select  COUNT(T03.T03_HEYA_CD) as tatemono_count
			from	T03WEB_HEYA T03 " . $from . "
			where	T03.T03_TODOUFUKEN_CD	IN (" . $prefs . ")";

            // 市区町村条件－－－－－－－－－－－－－－
            // 町条件があれば→カウント
            if (isset($chous) && sizeof($chous) > 0)
            {

                // 単独市区町村がある場合
                if ($cityCds != '')
                {

                    $sql .= " AND (";

                    $sql .= " T03.T03_SHIKUCHOUSON_CD	IN (" . $cities . ")";
                    $sql .= " OR T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";

                    $sql .= ") ";
                }
                else
                {
                    $sql .= " AND  T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";
                }
            }
            else
            { // 町条件がない
                $sql .= " and T03.T03_SHIKUCHOUSON_CD	IN (" . $cities . ")";
            }
            $sql .= "   and		T03.T03_DAIHYO_FLG		=	1 ";
            $sql .= $where;
        }
        return $this->dbGetData($sql, $dbParams);
    }

    // Pickup
    public function getPickupForArea($prefCds, $cityCds, $chous, $from, $where, $dbParams)
    {
        unset($dbParams['favirote']);
        $sql .= "
			 SELECT (CASE WHEN TP.T03_TENPO_CD IS NOT NULL THEN 1 ELSE 0 END) AS pos,
					   (CASE WHEN TP.T03_TENPO_CD IS NOT NULL THEN 1 ELSE 0 END) AS pickup,
					   T03.*
				FROM T03WEB_HEYA T03
				LEFT JOIN T03SHINCHAKU_BUKKEN_TENPO TP ON T03.T03_TENPO_CD = TP.T03_TENPO_CD
						AND T03.T03_HEYA_CD = T03.T03_TENPO_CD
				WHERE	T03.T03_TODOUFUKEN_CD	IN (" . $prefCds . ")";

        // 町条件があれば→カウント
        if (isset($chous) && sizeof($chous) > 0)
        {

            // 単独市区町村がある場合
            if ($cityCds != '')
            {
                $sql .= " AND (";
                $sql .= " T03.T03_SHIKUCHOUSON_CD	IN (" . $cityCds . ")";
                $sql .= " OR T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";
                $sql .= ") ";
            }
            else
            {
                $sql .= " AND  T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";
            }
        }
        else
        { // 町条件がない
            $sql .= " and T03.T03_SHIKUCHOUSON_CD	IN (" . $cityCds . ")";
        }

        $sql .= " and T03.T03_DAIHYO_FLG=1 " . $where . ' ORDER BY pickup DESC, T03.T03_TATEMONO_NAME_KOUKAI DESC, DBMS_RANDOM.RANDOM';
        $sql = 'SELECT * FROM (' . $sql . ') WHERE rownum = 1';
        return $this->dbGetData($sql, $dbParams);
    }

    public function getListForArea($prefCds, $cityCds, $chous, $from, $where, $order, $suborder, $dbParams, $picture_list)
    {

        // ★★★都道府県
        $preflst = split(" , ", $prefCds);
        $prefVal = [];
        foreach ($preflst as $pref)
        {
            $val = $dbParams[$pref];
            if (!in_array($val, $prefLst))
            {
                $prefVal[] = $val;
            }
            unset($dbParams[$pref]);
        }
        $prefs = "'" . join("','", $prefVal) . "'";
        // ★★★都道府県

        // ★★★市区
        $citylst = split(" , ", $cityCds);
        $cityVal = [];
        foreach ($citylst as $city)
        {
            $val = $dbParams[$city];
            if (!in_array($val, $cityVal))
            {
                $cityVal[] = $val;
            }
            unset($dbParams[$city]);
        }
        $cities = "'" . join("','", $cityVal) . "'";
        // ★★★市区

        $notWhere = 'AND EXISTS (SELECT 1 FROM M05TENPO_INFO M05 WHERE T03.T03_TENPO_CD = M05.M05_TENPO_CD AND M05.M05_KOUKAI_FLAG = 1)';

        $groupby = $picture_list ? "T03.T03_HEYA_CD, T03.T03_DAIHYO_TATEMONO_CD" : "T03.T03_DAIHYO_TATEMONO_CD";
        $col = $picture_list ? "T03.T03_HEYA_CD, " : "";

        $sql = "
select
	t.*
from
	(
		select distinct
			min_chinryo
			,max_chinryo
			,max_touroku
			,max_senyuu_menseki
			,max_tiku_nensu
			,T03.T03_HEYA_CD
			,tate.T03_TATEMONO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,tate.T03_TENPO_CD as TATEMONO_T03_TENPO_CD
			,tate.T03_ORIGINAL_TATEMONO_CD01
			,tate.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,tate.T03_TODOUFUKEN_CD
			,tate.T03_SHIKUCHOUSON_CD
			,tate.T03_CHOUMEI_CD
		    ,tate.T03_CHOUMOKU_CD
		    ,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,tate.T03_TATEMONO_TYPE_CD
		    ,tate.T03_TATEMONO_TYPE
		    ,tate.T03_TATEMONO_KOUZOU_CD
		    ,tate.T03_TATEMONO_KOUZOU
		    ,tate.T03_KAIDATE
		    ,tate.T03_KOSUU
		    ,tate.T03_KANSEINEN
		    ,tate.T03_KANSEITSUKI
		    ,tate.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,tate.T03_TATEMONO_MENSEKI
			,tate.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,tate.T03_KOUTSUU_CD01
			,tate.T03_ENSEN_CD01
			,tate.T03_ENSEN_NAME
			,tate.T03_EKI_CD01
			,tate.T03_EKI_NAME
			,tate.T03_BUS_GAISHA
			,tate.T03_BUS_JYOUSHA
			,tate.T03_BUS_STOP
			,tate.T03_TOHO01
			,tate.T03_KOUTSUU_BIKOU01
			,tate.T03_KOUTSUU_TEXT01
			,tate.T03_RENRAKU_EKI_CD01
			,tate.T03_KOUTSUU_CD02
			,tate.T03_ENSEN_CD02
			,tate.T03_ENSEN_NAME02
			,tate.T03_EKI_CD02
			,tate.T03_EKI_NAME02
			,tate.T03_BUS_GAISHA02
			,tate.T03_BUS_JYOUSHA02
			,tate.T03_BUS_STOP02
			,tate.T03_TOHO02
			,tate.T03_KOUTSUU_BIKOU02
			,tate.T03_KOUTSUU_TEXT02
			,tate.T03_RENRAKU_EKI_CD02
			,tate.T03_KOUTSUU_CD03
			,tate.T03_ENSEN_CD03
			,tate.T03_ENSEN_NAME03
			,tate.T03_EKI_CD03
			,tate.T03_EKI_NAME03
			,tate.T03_BUS_GAISHA03
			,tate.T03_BUS_JYOUSHA03
			,tate.T03_BUS_STOP03
			,tate.T03_TOHO03
			,tate.T03_KOUTSUU_BIKOU03
			,tate.T03_KOUTSUU_TEXT03
			,tate.T03_RENRAKU_EKI_CD03
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_GAIKAN_GAZOU02
			,tate.T03_GAIKAN_GAZOU03
			,tate.T03_GAIKAN_GAZOU04
			,tate.T03_GAIKAN_GAZOU05
			,tate.T03_SHUHEN_GAZOU01
			,tate.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10

			,tate.T03_GAIKAN_BIKOU01
			,tate.T03_GAIKAN_BIKOU02
			,tate.T03_GAIKAN_BIKOU03
			,T03.T03_NAISOU_BIKOU01
			,T03.T03_NAISOU_BIKOU02
			,T03.T03_NAISOU_BIKOU03
			,T03.T03_NAISOU_BIKOU04
			,T03.T03_NAISOU_BIKOU05
			,T03.T03_NAISOU_BIKOU06
			,T03.T03_NAISOU_BIKOU07
			,T03.T03_NAISOU_BIKOU08
			,T03.T03_NAISOU_BIKOU09
			,T03.T03_NAISOU_BIKOU10

			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,tate.T03_GAIKAN_GAZOU_COMMON01
			,tate.T03_GAIKAN_GAZOU_COMMON02
			,tate.T03_GAIKAN_GAZOU_COMMON03
			,tate.T03_GAIKAN_GAZOU_COMMON04
			,tate.T03_GAIKAN_GAZOU_COMMON05
			,tate.T03_HAICHIZU_COMMON
			,tate.T03_SHUHEN_GAZOU_COMMON01
			,tate.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END AS SHINCHAKU_FLAG
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO_DESC
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,tate.T03_TATEMONO_NAME_KANA
			,min(tate.T03_MEYASU_CHINRYO) as T03_MEYASU_CHINRYO_MIN
			,max(tate.T03_MEYASU_CHINRYO) as T03_MEYASU_CHINRYO_MAX
			,T03.T03_SETSUBI16              as T03_SETSUBI16_ICON
			,T03.T03_SETSUBI63              as T03_SETSUBI63_ICON
			,T03.T03_SETSUBI03              as T03_SETSUBI03_ICON
			,T03.T03_SETSUBI34              as T03_SETSUBI34_ICON
			,T03.T03_SETSUBI35              as T03_SETSUBI35_ICON
			,T03.T03_SETSUBI08              as T03_SETSUBI08_ICON
			,T03.T03_SETSUBI09              as T03_SETSUBI09_ICON
			,T03.T03_SETSUBI23              as T03_SETSUBI23_ICON
			,T03.T03_SETSUBI98              as T03_SETSUBI98_ICON
			,T03.T03_SETSUBI71              as T03_SETSUBI71_ICON
			,T03.T03_NYUUKYO_JYOUKEN12      as T03_NYUUKYO_JYOUKEN12_ICON
			,T03.T03_SETSUBI24              as T03_SETSUBI24_ICON
			,T03.T03_SETSUBI02              as T03_SETSUBI02_ICON
			,T03.T03_SETSUBI64              as T03_SETSUBI64_ICON
			,T03.T03_SETSUBI15              as T03_SETSUBI15_ICON
			,T03.T03_SETSUBI01              as T03_SETSUBI01_ICON
			,T03.T03_SETSUBI57              as T03_SETSUBI57_ICON
			,T03.T03_SETSUBI31              as T03_SETSUBI31_ICON
			,T03.T03_FREERENT_FLAG          as T03_FREERENT_FLAG_ICON
			,T03.T03_NYUUKYO_JYOUKEN02      as T03_NYUUKYO_JYOUKEN02_ICON
			,T03.T03_SETSUBI67              as T03_SETSUBI67_ICON
			,T03.T03_SETSUBI45              as T03_SETSUBI45_ICON
			,T03.T03_SETSUBI29              as T03_SETSUBI29_ICON
			,T03.T03_SETSUBI32              as T03_SETSUBI32_ICON
			,T03.T03_SETSUBI47              as T03_SETSUBI47_ICON
			,T03.T03_NYUUKYO_JYOUKEN03      as T03_NYUUKYO_JYOUKEN03_ICON
			,T03.T03_SETSUBI68              as T03_SETSUBI68_ICON
			,T03.T03_NYUUKYO_JYOUKEN01      as T03_NYUUKYO_JYOUKEN01_ICON
			,T03.T03_SETSUBI43              as T03_SETSUBI43_ICON
			,T03.T03_SETSUBI85              as T03_SETSUBI85_ICON
			,T03.T03_SETSUBI14              as T03_SETSUBI14_ICON
			,T03.T03_NYUUKYO_JYOUKEN10      as T03_NYUUKYO_JYOUKEN10_ICON
			,T03.T03_SETSUBI33              as T03_SETSUBI33_ICON
			,T03.T03_SETSUBI93              as T03_SETSUBI93_ICON
			,T03.T03_SETSUBI83              as T03_SETSUBI83_ICON
			,case when (T03.T03_TOHO01 <= 3 and T03.T03_EKI_CD01 IS NOT NULL and T03.T03_BUS_GAISHA IS NULL) or (T03.T03_TOHO02 <= 3 and T03.T03_EKI_CD02 IS NOT NULL and T03.T03_BUS_GAISHA02 IS NULL) or (T03.T03_TOHO03 <= 3 and T03.T03_EKI_CD03 IS NOT NULL and T03.T03_BUS_GAISHA03 IS NULL) then 1 else 0 end as T03_TOHO_ICON
			,T03.T03_SETSUBI70              as T03_SETSUBI70_ICON
			,T03.T03_NYUUKYO_JYOUKEN11      as T03_NYUUKYO_JYOUKEN11_ICON
			,T03.T03_SETSUBI72              as T03_SETSUBI72_ICON
			,T03.T03_SETSUBI82              as T03_SETSUBI82_ICON
			,T03.T03_SETSUBI86              as T03_SETSUBI86_ICON
			,T03.T03_SETSUBI94              as T03_SETSUBI94_ICON
			,T03.T03_SETSUBI61              as T03_SETSUBI61_ICON
			,T03.T03_SETSUBI38              as T03_SETSUBI38_ICON
			,T03.T03_SETSUBI56              as T03_SETSUBI56_ICON
		from
			(
				select * from
					(
						select	t.*,rownum as row_id
						from
							(
								select DISTINCT
									$col
									T03.T03_DAIHYO_TATEMONO_CD
									,min(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as min_chinryo
									,max(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as max_chinryo
									,max(T03.T03_KOUSHINBI)           as max_touroku
									,max(T03.T03_SENYUU_MENSEKI)          as max_senyuu_menseki
									,max(T03.T03_TIKU_NENSU)	as max_tiku_nensu
								from	T03WEB_HEYA T03 " . $from . "
								where	T03.T03_TODOUFUKEN_CD	IN (" . $prefs . ")";

        // 市区町村条件－－－－－－－－－－－－－－
        // 町条件があれば→カウント
        if (isset($chous) && sizeof($chous) > 0)
        {

            // 単独市区町村がある場合
            if ($cityCds != '')
            {

                $sql .= " AND (";

                $sql .= " T03.T03_SHIKUCHOUSON_CD	IN (" . $cities . ")";
                $sql .= " OR T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";

                $sql .= ") ";
            }
            else
            {
                $sql .= " AND  T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";
            }
        }
        else
        { // 町条件がない
            $sql .= " and T03.T03_SHIKUCHOUSON_CD	IN (" . $cities . ")";
        }
        // 市区町村条件－－－－－－－－－－－－－－

        // and T03.T03_SHIKUCHOUSON_CD IN (".$cityCds.")
        // ピッチャービューの場合→名寄せフラグみない
        if (!$picture_list)
        {
            $sql .= "                       and		T03.T03_DAIHYO_FLG		=	1 ";
        }
        $sql .= $where . "
								group by
									$groupby
								order by
									" . $order . "
									,T03.T03_DAIHYO_TATEMONO_CD
							) t
					)
				where row_id between :pagerFrom and :pagerTo
			) t1
			inner join T03WEB_HEYA T03 on T03.T03_DAIHYO_TATEMONO_CD = t1.T03_DAIHYO_TATEMONO_CD
			inner join T03WEB_HEYA tate on tate.T03_TATEMONO_CD        = t1.T03_DAIHYO_TATEMONO_CD
                         " . $from . "
		where ";
        if (!$picture_list)
        {
            $sql .= "T03.T03_DAIHYO_FLG		=	1
		--and	tate.T03_DAIHYO_FLG		=	1
 		";
        }
        else
        {
            $sql .= ' T03.T03_HEYA_CD = t1.T03_HEYA_CD ';
        }

        $sql .= str_replace($notWhere, '', $where) . "
		group by
			min_chinryo
			,max_chinryo
			,max_touroku
			,max_senyuu_menseki
			,max_tiku_nensu
			,T03.T03_HEYA_CD
			,tate.T03_TATEMONO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,tate.T03_TENPO_CD
			,tate.T03_ORIGINAL_TATEMONO_CD01
			,tate.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,tate.T03_TODOUFUKEN_CD
			,tate.T03_SHIKUCHOUSON_CD
			,tate.T03_CHOUMEI_CD
		    ,tate.T03_CHOUMOKU_CD
		    ,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,tate.T03_TATEMONO_TYPE_CD
		    ,tate.T03_TATEMONO_TYPE
		    ,tate.T03_TATEMONO_KOUZOU_CD
		    ,tate.T03_TATEMONO_KOUZOU
		    ,tate.T03_KAIDATE
		    ,tate.T03_KOSUU
		    ,tate.T03_KANSEINEN
		    ,tate.T03_KANSEITSUKI
		    ,tate.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,tate.T03_TATEMONO_MENSEKI
			,tate.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,tate.T03_KOUTSUU_CD01
			,tate.T03_ENSEN_CD01
			,tate.T03_ENSEN_NAME
			,tate.T03_EKI_CD01
			,tate.T03_EKI_NAME
			,tate.T03_BUS_GAISHA
			,tate.T03_BUS_JYOUSHA
			,tate.T03_BUS_STOP
			,tate.T03_TOHO01
			,tate.T03_KOUTSUU_BIKOU01
			,tate.T03_KOUTSUU_TEXT01
			,tate.T03_RENRAKU_EKI_CD01
			,tate.T03_KOUTSUU_CD02
			,tate.T03_ENSEN_CD02
			,tate.T03_ENSEN_NAME02
			,tate.T03_EKI_CD02
			,tate.T03_EKI_NAME02
			,tate.T03_BUS_GAISHA02
			,tate.T03_BUS_JYOUSHA02
			,tate.T03_BUS_STOP02
			,tate.T03_TOHO02
			,tate.T03_KOUTSUU_BIKOU02
			,tate.T03_KOUTSUU_TEXT02
			,tate.T03_RENRAKU_EKI_CD02
			,tate.T03_KOUTSUU_CD03
			,tate.T03_ENSEN_CD03
			,tate.T03_ENSEN_NAME03
			,tate.T03_EKI_CD03
			,tate.T03_EKI_NAME03
			,tate.T03_BUS_GAISHA03
			,tate.T03_BUS_JYOUSHA03
			,tate.T03_BUS_STOP03
			,tate.T03_TOHO03
			,tate.T03_KOUTSUU_BIKOU03
			,tate.T03_KOUTSUU_TEXT03
			,tate.T03_RENRAKU_EKI_CD03
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_GAIKAN_GAZOU02
			,tate.T03_GAIKAN_GAZOU03
			,tate.T03_GAIKAN_GAZOU04
			,tate.T03_GAIKAN_GAZOU05
			,tate.T03_SHUHEN_GAZOU01
			,tate.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10

            ,tate.T03_GAIKAN_BIKOU01
			,tate.T03_GAIKAN_BIKOU02
			,tate.T03_GAIKAN_BIKOU03
			,T03.T03_NAISOU_BIKOU01
			,T03.T03_NAISOU_BIKOU02
			,T03.T03_NAISOU_BIKOU03
			,T03.T03_NAISOU_BIKOU04
			,T03.T03_NAISOU_BIKOU05
			,T03.T03_NAISOU_BIKOU06
			,T03.T03_NAISOU_BIKOU07
			,T03.T03_NAISOU_BIKOU08
			,T03.T03_NAISOU_BIKOU09
			,T03.T03_NAISOU_BIKOU10

			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,tate.T03_GAIKAN_GAZOU_COMMON01
			,tate.T03_GAIKAN_GAZOU_COMMON02
			,tate.T03_GAIKAN_GAZOU_COMMON03
			,tate.T03_GAIKAN_GAZOU_COMMON04
			,tate.T03_GAIKAN_GAZOU_COMMON05
			,tate.T03_HAICHIZU_COMMON
			,tate.T03_SHUHEN_GAZOU_COMMON01
			,tate.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END)
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END)
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,tate.T03_TATEMONO_NAME_KANA
			,T03.T03_SETSUBI16
			,T03.T03_SETSUBI63
			,T03.T03_SETSUBI03
			,T03.T03_SETSUBI34
			,T03.T03_SETSUBI35
			,T03.T03_SETSUBI08
			,T03.T03_SETSUBI09
			,T03.T03_SETSUBI23
			,T03.T03_SETSUBI98
			,T03.T03_SETSUBI71
			,T03.T03_NYUUKYO_JYOUKEN12
			,T03.T03_SETSUBI24
			,T03.T03_SETSUBI02
			,T03.T03_SETSUBI64
			,T03.T03_SETSUBI15
			,T03.T03_SETSUBI01
			,T03.T03_SETSUBI57
			,T03.T03_SETSUBI31
			,T03.T03_FREERENT_FLAG
			,T03.T03_NYUUKYO_JYOUKEN02
			,T03.T03_SETSUBI67
			,T03.T03_SETSUBI45
			,T03.T03_SETSUBI29
			,T03.T03_SETSUBI32
			,T03.T03_SETSUBI47
			,T03.T03_NYUUKYO_JYOUKEN03
			,T03.T03_SETSUBI68
			,T03.T03_NYUUKYO_JYOUKEN01
			,T03.T03_SETSUBI43
			,T03.T03_SETSUBI85
			,T03.T03_SETSUBI14
			,T03.T03_NYUUKYO_JYOUKEN10
			,T03.T03_SETSUBI33
			,T03.T03_SETSUBI93
			,T03.T03_SETSUBI83
			,case when (T03.T03_TOHO01 <= 3 and T03.T03_EKI_CD01 IS NOT NULL and T03.T03_BUS_GAISHA IS NULL) or (T03.T03_TOHO02 <= 3 and T03.T03_EKI_CD02 IS NOT NULL and T03.T03_BUS_GAISHA02 IS NULL) or (T03.T03_TOHO03 <= 3 and T03.T03_EKI_CD03 IS NOT NULL and T03.T03_BUS_GAISHA03 IS NULL) then 1 else 0 end
			,T03.T03_SETSUBI70
			,T03.T03_NYUUKYO_JYOUKEN11
			,T03.T03_SETSUBI72
			,T03.T03_SETSUBI82
			,T03.T03_SETSUBI86
			,T03.T03_SETSUBI94
			,T03.T03_SETSUBI61
			,T03.T03_SETSUBI38
			,T03.T03_SETSUBI56
		order by
			" . $order . $suborder . "
			--,T03.T03_DAIHYO_TATEMONO_CD
			--,lpad(T03.T03_KAI,5)
			,lpad(T03.T03_HEYA_BANGOU,28)
			,T03.T03_HEYA_CD
	) t

";

        return $this->dbGetList($sql, $dbParams);
    }

    public function getCountForLine($prefCds, $stCds, $from, $where, $dbParams, $picture_list)
    {

        // ★★★都道府県
        $preflst = split(" , ", $prefCds);
        $prefVal = [];
        foreach ($preflst as $pref)
        {
            $val = $dbParams[$pref];
            if (!in_array($val, $prefLst))
            {
                $prefVal[] = $val;
            }
            unset($dbParams[$pref]);
        }
        $prefs = "'" . join("','", $prefVal) . "'";
        // ★★★都道府県

        // ★★★市区
        $stlst = split(" , ", $stCds);
        $stVal = [];
        foreach ($stlst as $st)
        {
            $val = $dbParams[$st];
            if (!in_array($val, $stVal))
            {
                $stVal[] = $val;
            }
            unset($dbParams[$st]);
        }
        $sts = "'" . join("','", $stVal) . "'";
        // ★★★市区

        $notWhere = 'AND EXISTS (SELECT 1 FROM M05TENPO_INFO M05 WHERE T03.T03_TENPO_CD = M05.M05_TENPO_CD AND M05.M05_KOUKAI_FLAG = 1)';
        if (!isset($from) || empty($from)) $from = '';

        // 条件カウントの場合→物件単位
        if (isset($dbParams['favirote']) && $dbParams['favirote'])
        {
            unset($dbParams['favirote']);
            $sql = "
			select COUNT(DISTINCT T03.T03_HEYA_CD) as tatemono_count
			from
			(
				select M03_ENSEN_CD, M03_EKI_CD
				from M03EKI
				where M03_RENRAKU_EKI_CD in
				(
					select 	M03_RENRAKU_EKI_CD
					from M03EKI M03
					where M03_EKI_CD in ( " . $sts . " )
				)
				union
				select	M03_ENSEN_CD, M03_EKI_CD
				from	M03EKI M03
				where	M03_EKI_CD in ( " . $sts . " )
			) m03 ,
			T03WEB_HEYA T03 " . $from . "
			where	T03.T03_TODOUFUKEN_CD	IN	(" . $prefs . ")
			and		T03.T03_DAIHYO_FLG		=	1";

            // 駅徒歩が選択されている場合を考慮したSQL文を生成
            $sql .= Rstobi_Model_Common::getEkitohoEkiCondition($dbParams);
            $sql .= $where;
        }
        else
        {
            $col = $picture_list ? "distinct T03.T03_HEYA_CD" : "distinct T03.T03_DAIHYO_TATEMONO_CD";
            $whr = $picture_list ? " " : " and T03.T03_DAIHYO_FLG = 1 ";
            $sql = " select  count($col) as tatemono_count
			 		from (
					select
						M03_ENSEN_CD, M03_EKI_CD
					from
						M03EKI
					where M03_RENRAKU_EKI_CD in
								(
									select 	M03_RENRAKU_EKI_CD
									from
										M03EKI M03
									where
										M03_EKI_CD in ( " . $sts . " )
								)
								union
								select	M03_ENSEN_CD, M03_EKI_CD
								from	M03EKI M03
								where	M03_EKI_CD in ( " . $sts . " )
				) m03 ,
				T03WEB_HEYA T03 " . $from . "
			where	T03.T03_TODOUFUKEN_CD	IN	(" . $prefs . ")" . $whr;

            // 駅徒歩が選択されている場合を考慮したSQL文を生成
            $sql .= Rstobi_Model_Common::getEkitohoEkiCondition($dbParams);
            $sql .= $where;
        }

        return $this->dbGetData($sql, $dbParams);
    }

    // Pickup
    public function getPickupForLine($prefCds, $stCds, $from, $where, $dbParams)
    {
        unset($dbParams['favirote']);

        $sql .= " SELECT T03.*
					from (
					select
						M03_ENSEN_CD, M03_EKI_CD
					from M03EKI
					where M03_RENRAKU_EKI_CD in
								(
									select 	M03_RENRAKU_EKI_CD
									from
										M03EKI M03
									where
										M03_EKI_CD in ( " . $stCds . " )
								)
								union
								select	M03_ENSEN_CD, M03_EKI_CD
								from	M03EKI M03
								where	M03_EKI_CD in ( " . $stCds . " )
				) m03 ,
				T03WEB_HEYA T03 " . $from . "
			where	T03.T03_TODOUFUKEN_CD	IN	(" . $prefCds . ")
			and T03.T03_DAIHYO_FLG	= 1";

            // 駅徒歩が選択されている場合を考慮したSQL文を生成
            $sql .= Rstobi_Model_Common::getEkitohoEkiCondition($dbParams);
			$sql .= $where . ' ORDER BY T03_TATEMONO_NAME_KOUKAI DESC, DBMS_RANDOM.RANDOM';

        $sql = 'SELECT * FROM (' . $sql . ') WHERE rownum = 1';

        return $this->dbGetData($sql, $dbParams);
    }

    public function getListForLine($prefCds, $stCds, $from, $where, $order, $suborder, $dbParams, $picture_list)
    {

        // ★★★都道府県
        $preflst = split(" , ", $prefCds);
        $prefVal = [];
        foreach ($preflst as $pref)
        {
            $val = $dbParams[$pref];
            if (!in_array($val, $prefLst))
            {
                $prefVal[] = $val;
            }
            unset($dbParams[$pref]);
        }
        $prefs = "'" . join("','", $prefVal) . "'";
        // ★★★都道府県

        // ★★★市区
        $stlst = split(" , ", $stCds);
        $stVal = [];
        foreach ($stlst as $st)
        {
            $val = $dbParams[$st];
            if (!in_array($val, $stVal))
            {
                $stVal[] = $val;
            }
            unset($dbParams[$st]);
        }
        $sts = "'" . join("','", $stVal) . "'";
        // ★★★市区

        $notWhere = 'AND EXISTS (SELECT 1 FROM M05TENPO_INFO M05 WHERE T03.T03_TENPO_CD = M05.M05_TENPO_CD AND M05.M05_KOUKAI_FLAG = 1)';

        $groupby = $picture_list ? "T03.T03_HEYA_CD, T03.T03_DAIHYO_TATEMONO_CD" : "T03.T03_DAIHYO_TATEMONO_CD";
        $col = $picture_list ? "T03.T03_HEYA_CD, " : "";

        $sql = "
select
	t.*
from
	(
		select DISTINCT
			min_chinryo
			,max_chinryo
			,max_touroku
			,max_senyuu_menseki
			,max_tiku_nensu
			,T03.T03_HEYA_CD
			,tate.T03_TATEMONO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,tate.T03_TENPO_CD as TATEMONO_T03_TENPO_CD
			,tate.T03_ORIGINAL_TATEMONO_CD01
			,tate.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,tate.T03_TODOUFUKEN_CD
			,tate.T03_SHIKUCHOUSON_CD
			,tate.T03_CHOUMEI_CD
		    ,tate.T03_CHOUMOKU_CD
		    ,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,tate.T03_TATEMONO_TYPE_CD
		    ,tate.T03_TATEMONO_TYPE
		    ,tate.T03_TATEMONO_KOUZOU_CD
		    ,tate.T03_TATEMONO_KOUZOU
		    ,tate.T03_KAIDATE
		    ,tate.T03_KOSUU
		    ,tate.T03_KANSEINEN
		    ,tate.T03_KANSEITSUKI
		    ,tate.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,tate.T03_TATEMONO_MENSEKI
			,tate.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,tate.T03_KOUTSUU_CD01
			,tate.T03_ENSEN_CD01
			,tate.T03_ENSEN_NAME
			,tate.T03_EKI_CD01
			,tate.T03_EKI_NAME
			,tate.T03_BUS_GAISHA
			,tate.T03_BUS_JYOUSHA
			,tate.T03_BUS_STOP
			,tate.T03_TOHO01
			,tate.T03_KOUTSUU_BIKOU01
			,tate.T03_KOUTSUU_TEXT01
			,tate.T03_RENRAKU_EKI_CD01
			,tate.T03_KOUTSUU_CD02
			,tate.T03_ENSEN_CD02
			,tate.T03_ENSEN_NAME02
			,tate.T03_EKI_CD02
			,tate.T03_EKI_NAME02
			,tate.T03_BUS_GAISHA02
			,tate.T03_BUS_JYOUSHA02
			,tate.T03_BUS_STOP02
			,tate.T03_TOHO02
			,tate.T03_KOUTSUU_BIKOU02
			,tate.T03_KOUTSUU_TEXT02
			,tate.T03_RENRAKU_EKI_CD02
			,tate.T03_KOUTSUU_CD03
			,tate.T03_ENSEN_CD03
			,tate.T03_ENSEN_NAME03
			,tate.T03_EKI_CD03
			,tate.T03_EKI_NAME03
			,tate.T03_BUS_GAISHA03
			,tate.T03_BUS_JYOUSHA03
			,tate.T03_BUS_STOP03
			,tate.T03_TOHO03
			,tate.T03_KOUTSUU_BIKOU03
			,tate.T03_KOUTSUU_TEXT03
			,tate.T03_RENRAKU_EKI_CD03
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_GAIKAN_GAZOU02
			,tate.T03_GAIKAN_GAZOU03
			,tate.T03_GAIKAN_GAZOU04
			,tate.T03_GAIKAN_GAZOU05
			,tate.T03_SHUHEN_GAZOU01
			,tate.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10
			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,tate.T03_GAIKAN_GAZOU_COMMON01
			,tate.T03_GAIKAN_GAZOU_COMMON02
			,tate.T03_GAIKAN_GAZOU_COMMON03
			,tate.T03_GAIKAN_GAZOU_COMMON04
			,tate.T03_GAIKAN_GAZOU_COMMON05
			,tate.T03_HAICHIZU_COMMON
			,tate.T03_SHUHEN_GAZOU_COMMON01
			,tate.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END AS SHINCHAKU_FLAG
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO_DESC
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,tate.T03_TATEMONO_NAME_KANA
			,min(tate.T03_MEYASU_CHINRYO) as T03_MEYASU_CHINRYO_MIN
			,max(tate.T03_MEYASU_CHINRYO) as T03_MEYASU_CHINRYO_MAX
			,T03.T03_SETSUBI16              as T03_SETSUBI16_ICON
			,T03.T03_SETSUBI63              as T03_SETSUBI63_ICON
			,T03.T03_SETSUBI03              as T03_SETSUBI03_ICON
			,T03.T03_SETSUBI34              as T03_SETSUBI34_ICON
			,T03.T03_SETSUBI35              as T03_SETSUBI35_ICON
			,T03.T03_SETSUBI08              as T03_SETSUBI08_ICON
			,T03.T03_SETSUBI09              as T03_SETSUBI09_ICON
			,T03.T03_SETSUBI23              as T03_SETSUBI23_ICON
			,T03.T03_SETSUBI98              as T03_SETSUBI98_ICON
			,T03.T03_SETSUBI71              as T03_SETSUBI71_ICON
			,T03.T03_NYUUKYO_JYOUKEN12      as T03_NYUUKYO_JYOUKEN12_ICON
			,T03.T03_SETSUBI24              as T03_SETSUBI24_ICON
			,T03.T03_SETSUBI02              as T03_SETSUBI02_ICON
			,T03.T03_SETSUBI64              as T03_SETSUBI64_ICON
			,T03.T03_SETSUBI15              as T03_SETSUBI15_ICON
			,T03.T03_SETSUBI01              as T03_SETSUBI01_ICON
			,T03.T03_SETSUBI57              as T03_SETSUBI57_ICON
			,T03.T03_SETSUBI31              as T03_SETSUBI31_ICON
			,T03.T03_FREERENT_FLAG          as T03_FREERENT_FLAG_ICON
			,T03.T03_NYUUKYO_JYOUKEN02      as T03_NYUUKYO_JYOUKEN02_ICON
			,T03.T03_SETSUBI67              as T03_SETSUBI67_ICON
			,T03.T03_SETSUBI45              as T03_SETSUBI45_ICON
			,T03.T03_SETSUBI29              as T03_SETSUBI29_ICON
			,T03.T03_SETSUBI32              as T03_SETSUBI32_ICON
			,T03.T03_SETSUBI47              as T03_SETSUBI47_ICON
			,T03.T03_NYUUKYO_JYOUKEN03      as T03_NYUUKYO_JYOUKEN03_ICON
			,T03.T03_SETSUBI68              as T03_SETSUBI68_ICON
			,T03.T03_NYUUKYO_JYOUKEN01      as T03_NYUUKYO_JYOUKEN01_ICON
			,T03.T03_SETSUBI43              as T03_SETSUBI43_ICON
			,T03.T03_SETSUBI85              as T03_SETSUBI85_ICON
			,T03.T03_SETSUBI14              as T03_SETSUBI14_ICON
			,T03.T03_NYUUKYO_JYOUKEN10      as T03_NYUUKYO_JYOUKEN10_ICON
			,T03.T03_SETSUBI33              as T03_SETSUBI33_ICON
			,T03.T03_SETSUBI93              as T03_SETSUBI93_ICON
			,T03.T03_SETSUBI83              as T03_SETSUBI83_ICON
			,case when (T03.T03_TOHO01 <= 3 and T03.T03_EKI_CD01 IS NOT NULL and T03.T03_BUS_GAISHA IS NULL) or (T03.T03_TOHO02 <= 3 and T03.T03_EKI_CD02 IS NOT NULL and T03.T03_BUS_GAISHA02 IS NULL) or (T03.T03_TOHO03 <= 3 and T03.T03_EKI_CD03 IS NOT NULL and T03.T03_BUS_GAISHA03 IS NULL) then 1 else 0 end as T03_TOHO_ICON
			,T03.T03_SETSUBI70              as T03_SETSUBI70_ICON
			,T03.T03_NYUUKYO_JYOUKEN11      as T03_NYUUKYO_JYOUKEN11_ICON
			,T03.T03_SETSUBI72              as T03_SETSUBI72_ICON
			,T03.T03_SETSUBI82              as T03_SETSUBI82_ICON
			,T03.T03_SETSUBI86              as T03_SETSUBI86_ICON
			,T03.T03_SETSUBI94              as T03_SETSUBI94_ICON
			,T03.T03_SETSUBI61              as T03_SETSUBI61_ICON
			,T03.T03_SETSUBI38              as T03_SETSUBI38_ICON
			,T03.T03_SETSUBI56              as T03_SETSUBI56_ICON
		from
			(
				select * from
					(
						select	t.*,
								rownum as row_id
						from
							(
								select
									$col
									T03.T03_DAIHYO_TATEMONO_CD
									,min(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as min_chinryo
									,max(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as max_chinryo
									,max(T03.T03_KOUSHINBI)           as max_touroku
									,max(T03.T03_SENYUU_MENSEKI)          as max_senyuu_menseki
									,max(T03.T03_TIKU_NENSU)	as max_tiku_nensu
								from	(
										select
											M03_ENSEN_CD, M03_EKI_CD
										from
											M03EKI
										where M03_RENRAKU_EKI_CD in
											(
												select 	M03_RENRAKU_EKI_CD
												from
													M03EKI M03
												where
													M03_EKI_CD in ( " . $sts . " )
											)
										union
										select	M03_ENSEN_CD, M03_EKI_CD
										from	M03EKI M03
										where	M03_EKI_CD in ( " . $sts . " )
										) m03 ,
										T03WEB_HEYA T03 " . $from . "
								where	T03.T03_TODOUFUKEN_CD	IN	(" . $prefs . ") ";
        // and T03.T03_DAIHYO_FLG = 1
        // ピッチャービューの場合→名寄せフラグみない
        if (!$picture_list)
        {
            $sql .= "                   and		T03.T03_DAIHYO_FLG		=	1 ";
        }

        // 駅徒歩が選択されている場合を考慮したSQL文を生成
        $sql .= Rstobi_Model_Common::getEkitohoEkiCondition($dbParams);
        $sql .= $where . "
								group by
									$groupby
								order by
									" . $order . "
									,T03.T03_DAIHYO_TATEMONO_CD
							) t
					)
				where row_id between :pagerFrom and :pagerTo
			) t1
			inner join T03WEB_HEYA   T03 on T03.T03_DAIHYO_TATEMONO_CD = t1.T03_DAIHYO_TATEMONO_CD
			inner join T03WEB_HEYA   tate on tate.T03_TATEMONO_CD        = t1.T03_DAIHYO_TATEMONO_CD
                        " . $from . "
		where ";
        if (!$picture_list)
        {
            $sql .= "T03.T03_DAIHYO_FLG		=	1
		--and	tate.T03_DAIHYO_FLG		=	1
 	";
        }
        else
        {
            $sql .= ' T03.T03_HEYA_CD = t1.T03_HEYA_CD ';
        }

        $sql .= str_replace($notWhere, '', $where) . "
		group by
			min_chinryo
			,max_chinryo
			,max_touroku
			,max_senyuu_menseki
			,max_tiku_nensu
			,T03.T03_HEYA_CD
			,tate.T03_TATEMONO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,tate.T03_TENPO_CD
			,tate.T03_ORIGINAL_TATEMONO_CD01
			,tate.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,tate.T03_TODOUFUKEN_CD
			,tate.T03_SHIKUCHOUSON_CD
			,tate.T03_CHOUMEI_CD
		    ,tate.T03_CHOUMOKU_CD
		    ,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,tate.T03_TATEMONO_TYPE_CD
		    ,tate.T03_TATEMONO_TYPE
		    ,tate.T03_TATEMONO_KOUZOU_CD
		    ,tate.T03_TATEMONO_KOUZOU
		    ,tate.T03_KAIDATE
		    ,tate.T03_KOSUU
		    ,tate.T03_KANSEINEN
		    ,tate.T03_KANSEITSUKI
		    ,tate.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,tate.T03_TATEMONO_MENSEKI
			,tate.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,tate.T03_KOUTSUU_CD01
			,tate.T03_ENSEN_CD01
			,tate.T03_ENSEN_NAME
			,tate.T03_EKI_CD01
			,tate.T03_EKI_NAME
			,tate.T03_BUS_GAISHA
			,tate.T03_BUS_JYOUSHA
			,tate.T03_BUS_STOP
			,tate.T03_TOHO01
			,tate.T03_KOUTSUU_BIKOU01
			,tate.T03_KOUTSUU_TEXT01
			,tate.T03_RENRAKU_EKI_CD01
			,tate.T03_KOUTSUU_CD02
			,tate.T03_ENSEN_CD02
			,tate.T03_ENSEN_NAME02
			,tate.T03_EKI_CD02
			,tate.T03_EKI_NAME02
			,tate.T03_BUS_GAISHA02
			,tate.T03_BUS_JYOUSHA02
			,tate.T03_BUS_STOP02
			,tate.T03_TOHO02
			,tate.T03_KOUTSUU_BIKOU02
			,tate.T03_KOUTSUU_TEXT02
			,tate.T03_RENRAKU_EKI_CD02
			,tate.T03_KOUTSUU_CD03
			,tate.T03_ENSEN_CD03
			,tate.T03_ENSEN_NAME03
			,tate.T03_EKI_CD03
			,tate.T03_EKI_NAME03
			,tate.T03_BUS_GAISHA03
			,tate.T03_BUS_JYOUSHA03
			,tate.T03_BUS_STOP03
			,tate.T03_TOHO03
			,tate.T03_KOUTSUU_BIKOU03
			,tate.T03_KOUTSUU_TEXT03
			,tate.T03_RENRAKU_EKI_CD03
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_GAIKAN_GAZOU02
			,tate.T03_GAIKAN_GAZOU03
			,tate.T03_GAIKAN_GAZOU04
			,tate.T03_GAIKAN_GAZOU05
			,tate.T03_SHUHEN_GAZOU01
			,tate.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10
			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,tate.T03_GAIKAN_GAZOU_COMMON01
			,tate.T03_GAIKAN_GAZOU_COMMON02
			,tate.T03_GAIKAN_GAZOU_COMMON03
			,tate.T03_GAIKAN_GAZOU_COMMON04
			,tate.T03_GAIKAN_GAZOU_COMMON05
			,tate.T03_HAICHIZU_COMMON
			,tate.T03_SHUHEN_GAZOU_COMMON01
			,tate.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END)
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END)
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,tate.T03_TATEMONO_NAME_KANA
			,T03.T03_SETSUBI16
			,T03.T03_SETSUBI63
			,T03.T03_SETSUBI03
			,T03.T03_SETSUBI34
			,T03.T03_SETSUBI35
			,T03.T03_SETSUBI08
			,T03.T03_SETSUBI09
			,T03.T03_SETSUBI23
			,T03.T03_SETSUBI98
			,T03.T03_SETSUBI71
			,T03.T03_NYUUKYO_JYOUKEN12
			,T03.T03_SETSUBI24
			,T03.T03_SETSUBI02
			,T03.T03_SETSUBI64
			,T03.T03_SETSUBI15
			,T03.T03_SETSUBI01
			,T03.T03_SETSUBI57
			,T03.T03_SETSUBI31
			,T03.T03_FREERENT_FLAG
			,T03.T03_NYUUKYO_JYOUKEN02
			,T03.T03_SETSUBI67
			,T03.T03_SETSUBI45
			,T03.T03_SETSUBI29
			,T03.T03_SETSUBI32
			,T03.T03_SETSUBI47
			,T03.T03_NYUUKYO_JYOUKEN03
			,T03.T03_SETSUBI68
			,T03.T03_NYUUKYO_JYOUKEN01
			,T03.T03_SETSUBI43
			,T03.T03_SETSUBI85
			,T03.T03_SETSUBI14
			,T03.T03_NYUUKYO_JYOUKEN10
			,T03.T03_SETSUBI33
			,T03.T03_SETSUBI93
			,T03.T03_SETSUBI83
			,case when (T03.T03_TOHO01 <= 3 and T03.T03_EKI_CD01 IS NOT NULL and T03.T03_BUS_GAISHA IS NULL) or (T03.T03_TOHO02 <= 3 and T03.T03_EKI_CD02 IS NOT NULL and T03.T03_BUS_GAISHA02 IS NULL) or (T03.T03_TOHO03 <= 3 and T03.T03_EKI_CD03 IS NOT NULL and T03.T03_BUS_GAISHA03 IS NULL) then 1 else 0 end
			,T03.T03_SETSUBI70
			,T03.T03_NYUUKYO_JYOUKEN11
			,T03.T03_SETSUBI72
			,T03.T03_SETSUBI82
			,T03.T03_SETSUBI86
			,T03.T03_SETSUBI94
			,T03.T03_SETSUBI61
			,T03.T03_SETSUBI38
			,T03.T03_SETSUBI56
		order by
			" . $order . $suborder . "
			--,T03.T03_DAIHYO_TATEMONO_CD
			--,lpad(T03.T03_KAI,5)
			,lpad(T03.T03_HEYA_BANGOU,28)
			,T03.T03_HEYA_CD
	) t
";

        return $this->dbGetList($sql, $dbParams);
    }

    public function getCamp($heyaCd)
    {
        $db_params = array();
        $result = array();

        $db_params["heyaCd"] = $heyaCd;

        $sql = "";
        $sql .= " SELECT";
        $sql .= "     *";
        $sql .= " FROM";
        $sql .= "     (";
        $sql .= "         SELECT";
        $sql .= "             c.M94_ITEM_ICON,";
        $sql .= "             b.M94_CAMPAIGN_URL,";
        $sql .= "             b.M94_CAMPAIGN_NAME,";
        $sql .= "             b.M94_CAMPAIGN_KBN,";
        $sql .= "             b.M94_CAMPAIGN_TOKUSYU_KBN,";
        $sql .= "             b.M94_CAMPAIGN_PRIORITY_NO,";
        $sql .= "             b.M94_START_YMD";
        $sql .= "         FROM";
        $sql .= "             T03WEB_HEYA_CAMPAIGN a,";
        $sql .= "             M94CAMPAIGN          b,";
        $sql .= "             M94CAMPAIGN_ITEM     c";
        $sql .= "         WHERE";
        $sql .= "             a.T03_HEYA_CD = :heyaCd";
        $sql .= "         AND b.M94_CAMPAIGN_CD = a.T03_CAMPAIGN_CD";
        $sql .= "         AND NVL(b.M94_START_YMD,'99999999') <= TO_CHAR(SYSDATE, 'YYYYMMDD')";
        $sql .= "         AND NVL(b.M94_END_YMD,'99999999')   >= TO_CHAR(SYSDATE, 'YYYYMMDD')";
        $sql .= "         AND b.M94_DELETE_FLAG = 0";
        $sql .= "         AND b.M94_MOBILE_KBN  = '0'";
        $sql .= "         AND c.M94_CAMPAIGN_CD = a.T03_CAMPAIGN_CD";
        $sql .= "         AND (c.M94_ITEM_CD = a.T03_OTAKARA_CD or c.M94_CAMPAIGN_CD = 11 ) ";
        $sql .= "         AND NVL(c.M94_INSERT_DATE, SYSDATE+1) <= SYSDATE";
        $sql .= "         AND c.M94_DELETE_FLAG = 0";
        $sql .= "         AND (c.M94_DELETE_DATE > SYSDATE or c.M94_DELETE_DATE is null)";
        $sql .= "         UNION ALL";
        $sql .= "         SELECT";
        $sql .= "             c.M94_ITEM_ICON,";
        $sql .= "             b.M94_CAMPAIGN_URL,";
        $sql .= "             b.M94_CAMPAIGN_NAME,";
        $sql .= "             b.M94_CAMPAIGN_KBN,";
        $sql .= "             b.M94_CAMPAIGN_TOKUSYU_KBN,";
        $sql .= "             b.M94_CAMPAIGN_PRIORITY_NO,";
        $sql .= "             b.M94_START_YMD";
        $sql .= "         FROM ";
        $sql .= "             M94CAMPAIGN b";
        $sql .= "                 LEFT OUTER JOIN M94CAMPAIGN_ITEM c";
        $sql .= "                     ON c.M94_CAMPAIGN_CD = b.M94_CAMPAIGN_CD";
        $sql .= "                     AND c.M94_ITEM_CD = 1";
        $sql .= "                     AND NVL(c.M94_INSERT_DATE, SYSDATE+1) <= SYSDATE";
        $sql .= "                     AND c.M94_DELETE_FLAG = 0";
        $sql .= "                     AND (c.M94_DELETE_DATE > SYSDATE or c.M94_DELETE_DATE is null)";
        $sql .= "         WHERE ";
        $sql .= "             b.M94_CAMPAIGN_HYOUZI = 1 ";
        $sql .= "         AND b.M94_DELETE_FLAG = 0 ";
        $sql .= "         AND b.M94_CAMPAIGN_KBN IN (2,4) ";
        $sql .= "         AND b.M94_MOBILE_KBN = 0 ";
        $sql .= "         AND NVL(b.M94_START_YMD,'99999999') <= TO_CHAR(SYSDATE, 'YYYYMMDD')";
        $sql .= "         AND NVL(b.M94_END_YMD,'99999999')   >= TO_CHAR(SYSDATE, 'YYYYMMDD')";
        $sql .= "     )";
        $sql .= " order by";
        $sql .= "     M94_CAMPAIGN_KBN,";
        $sql .= "     M94_CAMPAIGN_TOKUSYU_KBN,";
        $sql .= "     M94_CAMPAIGN_PRIORITY_NO,";
        $sql .= "     NVL(M94_START_YMD,'99999999') desc";

        $temp = $this->dbGetList($sql, $db_params, $this->_db);

        // 結果の存在確認
        if (!empty($temp))
        {
            $result = $temp[0];
        }

        return $result;
    }

    // ★★★ショップ検索
    // 20150130-ショップの場合代表フラグ見ない
    public function getCountForShop($shopCd, $from, $where, $dbParams)
    {
        $notWhere = 'AND EXISTS (SELECT 1 FROM M05TENPO_INFO M05 WHERE T03.T03_TENPO_CD = M05.M05_TENPO_CD AND M05.M05_KOUKAI_FLAG = 1)';
        if (!isset($from) || empty($from)) $from = '';

        $sql = " select  count(distinct T03.T03_DAIHYO_TATEMONO_CD) as tatemono_count ";
        $sql .= " from T03WEB_HEYA T03 " . $from . "
			where  T03.T03_TENPO_CD	IN	('" . $shopCd . "') " . $where;

        // 条件カウントの場合→物件単位
        if (isset($dbParams['favirote']) && $dbParams['favirote'])
        {
            unset($dbParams['favirote']);
            $sql = "

		select COUNT(DISTINCT T03.T03_HEYA_CD) as tatemono_count
		from
			(
 				select DISTINCT T03.T03_DAIHYO_TATEMONO_CD
				from	T03WEB_HEYA T03 " . $from . "
				where	T03.T03_TENPO_CD	IN ('" . $shopCd . "') " . $where . "

			) t1
			inner join T03WEB_HEYA T03 on T03.T03_DAIHYO_TATEMONO_CD = t1.T03_DAIHYO_TATEMONO_CD
			inner join T03WEB_HEYA tate on tate.T03_TATEMONO_CD        = t1.T03_DAIHYO_TATEMONO_CD
				 				" . $from . "
            where T03.T03_TENPO_CD	IN ('" . $shopCd . "') " . str_replace($notWhere, '', $where);
        }
        return $this->dbGetData($sql, $dbParams);
    }

    // ★★★保存条件Pickup
    // 20150130-ショップの場合→代表フラグ見ない
    public function getPickupShop($shopCd, $from, $where, $dbParams)
    {
        unset($dbParams['favirote']);
        $sql = "SELECT * FROM (
				SELECT (CASE WHEN TP.T03_TENPO_CD IS NOT NULL THEN 1 ELSE 0 END) AS pos,
					   (CASE WHEN TP.T03_TENPO_CD IS NOT NULL THEN 1 ELSE 0 END) AS pickup,
					   T03.*
				FROM T03WEB_HEYA T03
				LEFT JOIN T03SHINCHAKU_BUKKEN_TENPO TP ON T03.T03_TENPO_CD = TP.T03_TENPO_CD
						AND T03.T03_HEYA_CD = T03.T03_TENPO_CD
				WHERE T03.T03_TENPO_CD	IN	(" . $shopCd . ") " . $where;
        $sql .= " ORDER BY pos DESC, T03_TATEMONO_NAME_KOUKAI DESC, DBMS_RANDOM.RANDOM) WHERE rownum = 1";
        return $this->dbGetData($sql, $dbParams);
    }

    // ★★★保存条件Pickup
    // ショップ検索の場合→代表フラグ見ない
    public function getListForShop($shopCd, $from, $where, $order, $suborder, $dbParams, $picture_list)
    {
        $notWhere = 'AND EXISTS (SELECT 1 FROM M05TENPO_INFO M05 WHERE T03.T03_TENPO_CD = M05.M05_TENPO_CD AND M05.M05_KOUKAI_FLAG = 1)';
        $groupby = $picture_list ? "T03.T03_HEYA_CD, T03.T03_DAIHYO_TATEMONO_CD" : "T03.T03_DAIHYO_TATEMONO_CD";
        $col = $picture_list ? "T03.T03_HEYA_CD, " : "";

        $sql = "
select
	t.*
from
	(
		select DISTINCT
			min_chinryo
			,max_chinryo
			,max_touroku
			,max_senyuu_menseki
			,max_tiku_nensu
			,T03.T03_HEYA_CD
			,tate.T03_TATEMONO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,T03.T03_TENPO_NAME
			,tate.T03_TENPO_CD as TATEMONO_T03_TENPO_CD
			,tate.T03_ORIGINAL_TATEMONO_CD01
			,tate.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,tate.T03_TODOUFUKEN_CD
			,tate.T03_SHIKUCHOUSON_CD
			,tate.T03_CHOUMEI_CD
		    ,tate.T03_CHOUMOKU_CD
		    ,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,tate.T03_TATEMONO_TYPE_CD
		    ,tate.T03_TATEMONO_TYPE
		    ,tate.T03_TATEMONO_KOUZOU_CD
		    ,tate.T03_TATEMONO_KOUZOU
		    ,tate.T03_KAIDATE
		    ,tate.T03_KOSUU
		    ,tate.T03_KANSEINEN
		    ,tate.T03_KANSEITSUKI
		    ,tate.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,tate.T03_TATEMONO_MENSEKI
			,tate.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,tate.T03_KOUTSUU_CD01
			,tate.T03_ENSEN_CD01
			,tate.T03_ENSEN_NAME
			,tate.T03_EKI_CD01
			,tate.T03_EKI_NAME
			,tate.T03_BUS_GAISHA
			,tate.T03_BUS_JYOUSHA
			,tate.T03_BUS_STOP
			,tate.T03_TOHO01
			,tate.T03_KOUTSUU_BIKOU01
			,tate.T03_KOUTSUU_TEXT01
			,tate.T03_RENRAKU_EKI_CD01
			,tate.T03_KOUTSUU_CD02
			,tate.T03_ENSEN_CD02
			,tate.T03_ENSEN_NAME02
			,tate.T03_EKI_CD02
			,tate.T03_EKI_NAME02
			,tate.T03_BUS_GAISHA02
			,tate.T03_BUS_JYOUSHA02
			,tate.T03_BUS_STOP02
			,tate.T03_TOHO02
			,tate.T03_KOUTSUU_BIKOU02
			,tate.T03_KOUTSUU_TEXT02
			,tate.T03_RENRAKU_EKI_CD02
			,tate.T03_KOUTSUU_CD03
			,tate.T03_ENSEN_CD03
			,tate.T03_ENSEN_NAME03
			,tate.T03_EKI_CD03
			,tate.T03_EKI_NAME03
			,tate.T03_BUS_GAISHA03
			,tate.T03_BUS_JYOUSHA03
			,tate.T03_BUS_STOP03
			,tate.T03_TOHO03
			,tate.T03_KOUTSUU_BIKOU03
			,tate.T03_KOUTSUU_TEXT03
			,tate.T03_RENRAKU_EKI_CD03
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_GAIKAN_GAZOU02
			,tate.T03_GAIKAN_GAZOU03
			,tate.T03_GAIKAN_GAZOU04
			,tate.T03_GAIKAN_GAZOU05
			,tate.T03_SHUHEN_GAZOU01
			,tate.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10

			,tate.T03_GAIKAN_BIKOU01
			,tate.T03_GAIKAN_BIKOU02
			,tate.T03_GAIKAN_BIKOU03
			,T03.T03_NAISOU_BIKOU01
			,T03.T03_NAISOU_BIKOU02
			,T03.T03_NAISOU_BIKOU03
			,T03.T03_NAISOU_BIKOU04
			,T03.T03_NAISOU_BIKOU05
			,T03.T03_NAISOU_BIKOU06
			,T03.T03_NAISOU_BIKOU07
			,T03.T03_NAISOU_BIKOU08
			,T03.T03_NAISOU_BIKOU09
			,T03.T03_NAISOU_BIKOU10

			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,tate.T03_GAIKAN_GAZOU_COMMON01
			,tate.T03_GAIKAN_GAZOU_COMMON02
			,tate.T03_GAIKAN_GAZOU_COMMON03
			,tate.T03_GAIKAN_GAZOU_COMMON04
			,tate.T03_GAIKAN_GAZOU_COMMON05
			,tate.T03_HAICHIZU_COMMON
			,tate.T03_SHUHEN_GAZOU_COMMON01
			,tate.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END AS SHINCHAKU_FLAG
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO_DESC
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,tate.T03_TATEMONO_NAME_KANA
			,min(tate.T03_MEYASU_CHINRYO) as T03_MEYASU_CHINRYO_MIN
			,max(tate.T03_MEYASU_CHINRYO) as T03_MEYASU_CHINRYO_MAX
			,T03.T03_SETSUBI16              as T03_SETSUBI16_ICON
			,T03.T03_SETSUBI63              as T03_SETSUBI63_ICON
			,T03.T03_SETSUBI03              as T03_SETSUBI03_ICON
			,T03.T03_SETSUBI34              as T03_SETSUBI34_ICON
			,T03.T03_SETSUBI35              as T03_SETSUBI35_ICON
			,T03.T03_SETSUBI08              as T03_SETSUBI08_ICON
			,T03.T03_SETSUBI09              as T03_SETSUBI09_ICON
			,T03.T03_SETSUBI23              as T03_SETSUBI23_ICON
			,T03.T03_SETSUBI98              as T03_SETSUBI98_ICON
			,T03.T03_SETSUBI71              as T03_SETSUBI71_ICON
			,T03.T03_NYUUKYO_JYOUKEN12      as T03_NYUUKYO_JYOUKEN12_ICON
			,T03.T03_SETSUBI24              as T03_SETSUBI24_ICON
			,T03.T03_SETSUBI02              as T03_SETSUBI02_ICON
			,T03.T03_SETSUBI64              as T03_SETSUBI64_ICON
			,T03.T03_SETSUBI15              as T03_SETSUBI15_ICON
			,T03.T03_SETSUBI01              as T03_SETSUBI01_ICON
			,T03.T03_SETSUBI57              as T03_SETSUBI57_ICON
			,T03.T03_SETSUBI31              as T03_SETSUBI31_ICON
			,T03.T03_FREERENT_FLAG          as T03_FREERENT_FLAG_ICON
			,T03.T03_NYUUKYO_JYOUKEN02      as T03_NYUUKYO_JYOUKEN02_ICON
			,T03.T03_SETSUBI67              as T03_SETSUBI67_ICON
			,T03.T03_SETSUBI45              as T03_SETSUBI45_ICON
			,T03.T03_SETSUBI29              as T03_SETSUBI29_ICON
			,T03.T03_SETSUBI32              as T03_SETSUBI32_ICON
			,T03.T03_SETSUBI47              as T03_SETSUBI47_ICON
			,T03.T03_NYUUKYO_JYOUKEN03      as T03_NYUUKYO_JYOUKEN03_ICON
			,T03.T03_SETSUBI68              as T03_SETSUBI68_ICON
			,T03.T03_NYUUKYO_JYOUKEN01      as T03_NYUUKYO_JYOUKEN01_ICON
			,T03.T03_SETSUBI43              as T03_SETSUBI43_ICON
			,T03.T03_SETSUBI85              as T03_SETSUBI85_ICON
			,T03.T03_SETSUBI14              as T03_SETSUBI14_ICON
			,T03.T03_NYUUKYO_JYOUKEN10      as T03_NYUUKYO_JYOUKEN10_ICON
			,T03.T03_SETSUBI33              as T03_SETSUBI33_ICON
			,T03.T03_SETSUBI93              as T03_SETSUBI93_ICON
			,T03.T03_SETSUBI83              as T03_SETSUBI83_ICON
			,case when (T03.T03_TOHO01 <= 3 and T03.T03_EKI_CD01 IS NOT NULL and T03.T03_BUS_GAISHA IS NULL) or (T03.T03_TOHO02 <= 3 and T03.T03_EKI_CD02 IS NOT NULL and T03.T03_BUS_GAISHA02 IS NULL) or (T03.T03_TOHO03 <= 3 and T03.T03_EKI_CD03 IS NOT NULL and T03.T03_BUS_GAISHA03 IS NULL) then 1 else 0 end as T03_TOHO_ICON
			,T03.T03_SETSUBI70              as T03_SETSUBI70_ICON
			,T03.T03_NYUUKYO_JYOUKEN11      as T03_NYUUKYO_JYOUKEN11_ICON
			,T03.T03_SETSUBI72              as T03_SETSUBI72_ICON
			,T03.T03_SETSUBI82              as T03_SETSUBI82_ICON
			,T03.T03_SETSUBI86              as T03_SETSUBI86_ICON
			,T03.T03_SETSUBI94              as T03_SETSUBI94_ICON
			,T03.T03_SETSUBI61              as T03_SETSUBI61_ICON
			,T03.T03_SETSUBI38              as T03_SETSUBI38_ICON
			,T03.T03_SETSUBI56              as T03_SETSUBI56_ICON
		from
			(
				select * from
					(
						select	t.*,rownum as row_id
						from
							(
								select DISTINCT
									$col
									T03.T03_DAIHYO_TATEMONO_CD
									,min(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as min_chinryo
									,max(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as max_chinryo
									,max(T03.T03_KOUSHINBI)           as max_touroku
									,max(T03.T03_SENYUU_MENSEKI)          as max_senyuu_menseki
									,max(T03.T03_TIKU_NENSU)	as max_tiku_nensu
								from	T03WEB_HEYA T03 " . $from . "
								where	T03.T03_TENPO_CD	IN ('" . $shopCd . "')";

        // ピッチャービューの場合→名寄せフラグみない
        // if(!$picture_list){
        // $sql .= " and T03.T03_DAIHYO_FLG = 1 ";
        // }
        $sql .= $where . "
 								group by
									T03.T03_DAIHYO_TATEMONO_CD
								order by
									" . $order . "
									,T03.T03_DAIHYO_TATEMONO_CD
							) t
					)
				where row_id between :pagerFrom and :pagerTo
			) t1
			inner join T03WEB_HEYA T03 on T03.T03_DAIHYO_TATEMONO_CD = t1.T03_DAIHYO_TATEMONO_CD
			inner join T03WEB_HEYA tate on tate.T03_TATEMONO_CD        = t1.T03_DAIHYO_TATEMONO_CD
                         " . $from . "
		where T03.T03_TENPO_CD	IN ('" . $shopCd . "')";

        // if(!$picture_list){
        // $sql .= "and T03.T03_DAIHYO_FLG = 1
        // and tate.T03_DAIHYO_FLG = 1 ";
        // }

        $sql .= str_replace($notWhere, '', $where) . "
		group by
			min_chinryo
			,max_chinryo
			,max_touroku
			,max_senyuu_menseki
			,max_tiku_nensu
			,T03.T03_HEYA_CD
			,tate.T03_TATEMONO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
            ,T03.T03_TENPO_NAME
			,tate.T03_TENPO_CD
			,tate.T03_ORIGINAL_TATEMONO_CD01
			,tate.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,tate.T03_TODOUFUKEN_CD
			,tate.T03_SHIKUCHOUSON_CD
			,tate.T03_CHOUMEI_CD
		    ,tate.T03_CHOUMOKU_CD
		    ,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,tate.T03_TATEMONO_TYPE_CD
		    ,tate.T03_TATEMONO_TYPE
		    ,tate.T03_TATEMONO_KOUZOU_CD
		    ,tate.T03_TATEMONO_KOUZOU
		    ,tate.T03_KAIDATE
		    ,tate.T03_KOSUU
		    ,tate.T03_KANSEINEN
		    ,tate.T03_KANSEITSUKI
		    ,tate.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,tate.T03_TATEMONO_MENSEKI
			,tate.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,tate.T03_KOUTSUU_CD01
			,tate.T03_ENSEN_CD01
			,tate.T03_ENSEN_NAME
			,tate.T03_EKI_CD01
			,tate.T03_EKI_NAME
			,tate.T03_BUS_GAISHA
			,tate.T03_BUS_JYOUSHA
			,tate.T03_BUS_STOP
			,tate.T03_TOHO01
			,tate.T03_KOUTSUU_BIKOU01
			,tate.T03_KOUTSUU_TEXT01
			,tate.T03_RENRAKU_EKI_CD01
			,tate.T03_KOUTSUU_CD02
			,tate.T03_ENSEN_CD02
			,tate.T03_ENSEN_NAME02
			,tate.T03_EKI_CD02
			,tate.T03_EKI_NAME02
			,tate.T03_BUS_GAISHA02
			,tate.T03_BUS_JYOUSHA02
			,tate.T03_BUS_STOP02
			,tate.T03_TOHO02
			,tate.T03_KOUTSUU_BIKOU02
			,tate.T03_KOUTSUU_TEXT02
			,tate.T03_RENRAKU_EKI_CD02
			,tate.T03_KOUTSUU_CD03
			,tate.T03_ENSEN_CD03
			,tate.T03_ENSEN_NAME03
			,tate.T03_EKI_CD03
			,tate.T03_EKI_NAME03
			,tate.T03_BUS_GAISHA03
			,tate.T03_BUS_JYOUSHA03
			,tate.T03_BUS_STOP03
			,tate.T03_TOHO03
			,tate.T03_KOUTSUU_BIKOU03
			,tate.T03_KOUTSUU_TEXT03
			,tate.T03_RENRAKU_EKI_CD03
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_GAIKAN_GAZOU02
			,tate.T03_GAIKAN_GAZOU03
			,tate.T03_GAIKAN_GAZOU04
			,tate.T03_GAIKAN_GAZOU05
			,tate.T03_SHUHEN_GAZOU01
			,tate.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10

            ,tate.T03_GAIKAN_BIKOU01
			,tate.T03_GAIKAN_BIKOU02
			,tate.T03_GAIKAN_BIKOU03
			,T03.T03_NAISOU_BIKOU01
			,T03.T03_NAISOU_BIKOU02
			,T03.T03_NAISOU_BIKOU03
			,T03.T03_NAISOU_BIKOU04
			,T03.T03_NAISOU_BIKOU05
			,T03.T03_NAISOU_BIKOU06
			,T03.T03_NAISOU_BIKOU07
			,T03.T03_NAISOU_BIKOU08
			,T03.T03_NAISOU_BIKOU09
			,T03.T03_NAISOU_BIKOU10

			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,tate.T03_GAIKAN_GAZOU_COMMON01
			,tate.T03_GAIKAN_GAZOU_COMMON02
			,tate.T03_GAIKAN_GAZOU_COMMON03
			,tate.T03_GAIKAN_GAZOU_COMMON04
			,tate.T03_GAIKAN_GAZOU_COMMON05
			,tate.T03_HAICHIZU_COMMON
			,tate.T03_SHUHEN_GAZOU_COMMON01
			,tate.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END)
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END)
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,tate.T03_TATEMONO_NAME_KANA
			,T03.T03_SETSUBI16
			,T03.T03_SETSUBI63
			,T03.T03_SETSUBI03
			,T03.T03_SETSUBI34
			,T03.T03_SETSUBI35
			,T03.T03_SETSUBI08
			,T03.T03_SETSUBI09
			,T03.T03_SETSUBI23
			,T03.T03_SETSUBI98
			,T03.T03_SETSUBI71
			,T03.T03_NYUUKYO_JYOUKEN12
			,T03.T03_SETSUBI24
			,T03.T03_SETSUBI02
			,T03.T03_SETSUBI64
			,T03.T03_SETSUBI15
			,T03.T03_SETSUBI01
			,T03.T03_SETSUBI57
			,T03.T03_SETSUBI31
			,T03.T03_FREERENT_FLAG
			,T03.T03_NYUUKYO_JYOUKEN02
			,T03.T03_SETSUBI67
			,T03.T03_SETSUBI45
			,T03.T03_SETSUBI29
			,T03.T03_SETSUBI32
			,T03.T03_SETSUBI47
			,T03.T03_NYUUKYO_JYOUKEN03
			,T03.T03_SETSUBI68
			,T03.T03_NYUUKYO_JYOUKEN01
			,T03.T03_SETSUBI43
			,T03.T03_SETSUBI85
			,T03.T03_SETSUBI14
			,T03.T03_NYUUKYO_JYOUKEN10
			,T03.T03_SETSUBI33
			,T03.T03_SETSUBI93
			,T03.T03_SETSUBI83
			,case when (T03.T03_TOHO01 <= 3 and T03.T03_EKI_CD01 IS NOT NULL and T03.T03_BUS_GAISHA IS NULL) or (T03.T03_TOHO02 <= 3 and T03.T03_EKI_CD02 IS NOT NULL and T03.T03_BUS_GAISHA02 IS NULL) or (T03.T03_TOHO03 <= 3 and T03.T03_EKI_CD03 IS NOT NULL and T03.T03_BUS_GAISHA03 IS NULL) then 1 else 0 end
			,T03.T03_SETSUBI70
			,T03.T03_NYUUKYO_JYOUKEN11
			,T03.T03_SETSUBI72
			,T03.T03_SETSUBI82
			,T03.T03_SETSUBI86
			,T03.T03_SETSUBI94
			,T03.T03_SETSUBI61
			,T03.T03_SETSUBI38
			,T03.T03_SETSUBI56
		order by
			" . $order . $suborder . "
			--,T03.T03_DAIHYO_TATEMONO_CD
			--,lpad(T03.T03_KAI,5)
			,lpad(T03.T03_HEYA_BANGOU,28)
			,T03.T03_HEYA_CD
	) t

";

        return $this->dbGetList($sql, $dbParams);
    }

    /*
     * 検討リスト取得
     */
    public function getBukenByCds($heyacds, $from, $dbParams)
    {
        $sql = "
		select
			--min_chinryo
			--,max_chinryo
			--,max_touroku
			--,max_senyuu_menseki
			--,max_tiku_nensu
			T03.T03_HEYA_CD
			,T03.T03_TATEMONO_CD
			,T03.T03_TATEMONO_NAME
			,T03.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,T03.T03_TENPO_CD as TATEMONO_T03_TENPO_CD
			,T03.T03_ORIGINAL_TATEMONO_CD01
			,T03.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,T03.T03_TODOUFUKEN_CD
			,T03.T03_SHIKUCHOUSON_CD
			,T03.T03_CHOUMEI_CD
		    ,T03.T03_CHOUMOKU_CD
		    ,T03.T03_JYUUSHO_TEXT
		    ,T03.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,T03.T03_TATEMONO_TYPE_CD
		    ,T03.T03_TATEMONO_TYPE
		    ,T03.T03_TATEMONO_KOUZOU_CD
		    ,T03.T03_TATEMONO_KOUZOU
		    ,T03.T03_KAIDATE
		    ,T03.T03_KOSUU
		    ,T03.T03_KANSEINEN
		    ,T03.T03_KANSEITSUKI
		    ,T03.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,T03.T03_TATEMONO_MENSEKI
			,T03.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,T03.T03_KOUTSUU_CD01
			,T03.T03_ENSEN_CD01
			,T03.T03_ENSEN_NAME
			,T03.T03_EKI_CD01
			,T03.T03_EKI_NAME
			,T03.T03_BUS_GAISHA
			,T03.T03_BUS_JYOUSHA
			,T03.T03_BUS_STOP
			,T03.T03_TOHO01
			,T03.T03_KOUTSUU_BIKOU01
			,T03.T03_KOUTSUU_TEXT01
			,T03.T03_RENRAKU_EKI_CD01
			,T03.T03_KOUTSUU_CD02
			,T03.T03_ENSEN_CD02
			,T03.T03_ENSEN_NAME02
			,T03.T03_EKI_CD02
			,T03.T03_EKI_NAME02
			,T03.T03_BUS_GAISHA02
			,T03.T03_BUS_JYOUSHA02
			,T03.T03_BUS_STOP02
			,T03.T03_TOHO02
			,T03.T03_KOUTSUU_BIKOU02
			,T03.T03_KOUTSUU_TEXT02
			,T03.T03_RENRAKU_EKI_CD02
			,T03.T03_KOUTSUU_CD03
			,T03.T03_ENSEN_CD03
			,T03.T03_ENSEN_NAME03
			,T03.T03_EKI_CD03
			,T03.T03_EKI_NAME03
			,T03.T03_BUS_GAISHA03
			,T03.T03_BUS_JYOUSHA03
			,T03.T03_BUS_STOP03
			,T03.T03_TOHO03
			,T03.T03_KOUTSUU_BIKOU03
			,T03.T03_KOUTSUU_TEXT03
			,T03.T03_RENRAKU_EKI_CD03
			,T03.T03_GAIKAN_GAZOU01
			,T03.T03_GAIKAN_GAZOU02
			,T03.T03_GAIKAN_GAZOU03
			,T03.T03_GAIKAN_GAZOU04
			,T03.T03_GAIKAN_GAZOU05
			,T03.T03_SHUHEN_GAZOU01
			,T03.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10

			,T03.T03_GAIKAN_BIKOU01
			,T03.T03_GAIKAN_BIKOU02
			,T03.T03_GAIKAN_BIKOU03
			,T03.T03_NAISOU_BIKOU01
			,T03.T03_NAISOU_BIKOU02
			,T03.T03_NAISOU_BIKOU03
			,T03.T03_NAISOU_BIKOU04
			,T03.T03_NAISOU_BIKOU05
			,T03.T03_NAISOU_BIKOU06
			,T03.T03_NAISOU_BIKOU07
			,T03.T03_NAISOU_BIKOU08
			,T03.T03_NAISOU_BIKOU09
			,T03.T03_NAISOU_BIKOU10

			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,T03.T03_GAIKAN_GAZOU_COMMON01
			,T03.T03_GAIKAN_GAZOU_COMMON02
			,T03.T03_GAIKAN_GAZOU_COMMON03
			,T03.T03_GAIKAN_GAZOU_COMMON04
			,T03.T03_GAIKAN_GAZOU_COMMON05
			,T03.T03_HAICHIZU_COMMON
			,T03.T03_SHUHEN_GAZOU_COMMON01
			,T03.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END AS SHINCHAKU_FLAG
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO_DESC
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,T03.T03_TATEMONO_NAME_KANA
			--,min(T03.T03_MEYASU_CHINRYO) as T03_MEYASU_CHINRYO_MIN
			--,max(T03.T03_MEYASU_CHINRYO) as T03_MEYASU_CHINRYO_MAX
			,T03.T03_SETSUBI16              as T03_SETSUBI16_ICON
			,T03.T03_SETSUBI63              as T03_SETSUBI63_ICON
			,T03.T03_SETSUBI03              as T03_SETSUBI03_ICON
			,T03.T03_SETSUBI34              as T03_SETSUBI34_ICON
			,T03.T03_SETSUBI35              as T03_SETSUBI35_ICON
			,T03.T03_SETSUBI08              as T03_SETSUBI08_ICON
			,T03.T03_SETSUBI09              as T03_SETSUBI09_ICON
			,T03.T03_SETSUBI23              as T03_SETSUBI23_ICON
			,T03.T03_SETSUBI98              as T03_SETSUBI98_ICON
			,T03.T03_SETSUBI71              as T03_SETSUBI71_ICON
			,T03.T03_NYUUKYO_JYOUKEN12      as T03_NYUUKYO_JYOUKEN12_ICON
			,T03.T03_SETSUBI24              as T03_SETSUBI24_ICON
			,T03.T03_SETSUBI02              as T03_SETSUBI02_ICON
			,T03.T03_SETSUBI64              as T03_SETSUBI64_ICON
			,T03.T03_SETSUBI15              as T03_SETSUBI15_ICON
			,T03.T03_SETSUBI01              as T03_SETSUBI01_ICON
			,T03.T03_SETSUBI57              as T03_SETSUBI57_ICON
			,T03.T03_SETSUBI31              as T03_SETSUBI31_ICON
			,T03.T03_FREERENT_FLAG          as T03_FREERENT_FLAG_ICON
			,T03.T03_NYUUKYO_JYOUKEN02      as T03_NYUUKYO_JYOUKEN02_ICON
			,T03.T03_SETSUBI67              as T03_SETSUBI67_ICON
			,T03.T03_SETSUBI45              as T03_SETSUBI45_ICON
			,T03.T03_SETSUBI29              as T03_SETSUBI29_ICON
			,T03.T03_SETSUBI32              as T03_SETSUBI32_ICON
			,T03.T03_SETSUBI47              as T03_SETSUBI47_ICON
			,T03.T03_NYUUKYO_JYOUKEN03      as T03_NYUUKYO_JYOUKEN03_ICON
			,T03.T03_SETSUBI68              as T03_SETSUBI68_ICON
			,T03.T03_NYUUKYO_JYOUKEN01      as T03_NYUUKYO_JYOUKEN01_ICON
			,T03.T03_SETSUBI43              as T03_SETSUBI43_ICON
			,T03.T03_SETSUBI85              as T03_SETSUBI85_ICON
			,T03.T03_SETSUBI14              as T03_SETSUBI14_ICON
			,T03.T03_NYUUKYO_JYOUKEN10      as T03_NYUUKYO_JYOUKEN10_ICON
			,T03.T03_SETSUBI33              as T03_SETSUBI33_ICON
			,T03.T03_SETSUBI93              as T03_SETSUBI93_ICON
			,T03.T03_SETSUBI83              as T03_SETSUBI83_ICON
			,case when (T03.T03_TOHO01 <= 3 and T03.T03_EKI_CD01 IS NOT NULL and T03.T03_BUS_GAISHA IS NULL) or (T03.T03_TOHO02 <= 3 and T03.T03_EKI_CD02 IS NOT NULL and T03.T03_BUS_GAISHA02 IS NULL) or (T03.T03_TOHO03 <= 3 and T03.T03_EKI_CD03 IS NOT NULL and T03.T03_BUS_GAISHA03 IS NULL) then 1 else 0 end as T03_TOHO_ICON
			,T03.T03_SETSUBI70              as T03_SETSUBI70_ICON
			,T03.T03_NYUUKYO_JYOUKEN11      as T03_NYUUKYO_JYOUKEN11_ICON
			,T03.T03_SETSUBI72              as T03_SETSUBI72_ICON
			,T03.T03_SETSUBI82              as T03_SETSUBI82_ICON
			,T03.T03_SETSUBI86              as T03_SETSUBI86_ICON
			,T03.T03_SETSUBI94              as T03_SETSUBI94_ICON
			,T03.T03_SETSUBI61              as T03_SETSUBI61_ICON
			,T03.T03_SETSUBI38              as T03_SETSUBI38_ICON
			,T03.T03_SETSUBI56              as T03_SETSUBI56_ICON

			FROM T03WEB_HEYA T03
		where T03.T03_HEYA_CD	IN (" . $heyacds . ")";

        // 名寄せフラグを見るかどうか
        if (isset($dbParams['MERGE_EXCLUDE']))
        {
            $sql .= "     AND T03.T03_DAIHYO_FLG	=	1 ";
        }
        unset($dbParams['MERGE_EXCLUDE']);
        // 名寄せフラグを見るかどうか

        $sql .= "order by
            T03.T03_DAIHYO_TATEMONO_CD
			,lpad(T03.T03_KAI,5)
			,lpad(T03.T03_HEYA_BANGOU,28)
			,T03.T03_HEYA_CD

";
        return $this->dbGetList($sql, $dbParams);
    }
    // 検討リストEND

    /**
     * **********************************
     * マップメソッド
     * *********************************
     */
    public function getListForAreaMap($prefCds, $cityCds, $chous, $from, $where, $dbParams)
    {

        // ★★★都道府県
        $preflst = split(" , ", $prefCds);
        $prefVal = [];
        foreach ($preflst as $pref)
        {
            $val = $dbParams[$pref];
            if (!in_array($val, $prefLst))
            {
                $prefVal[] = $val;
            }
            unset($dbParams[$pref]);
        }
        $prefs = "'" . join("','", $prefVal) . "'";
        // ★★★都道府県

        // ★★★市区
        $citylst = split(" , ", $cityCds);
        $cityVal = [];
        foreach ($citylst as $city)
        {
            $val = $dbParams[$city];
            if (!in_array($val, $cityVal))
            {
                $cityVal[] = $val;
            }
            unset($dbParams[$city]);
        }
        $cities = "'" . join("','", $cityVal) . "'";
        // ★★★市区

        $sql = "
		select
			min_chinryo
			,max_chinryo
			,min_madori
			,max_madori
			,T03.T03_DAIHYO_TATEMONO_CD
			,tate.T03_TENPO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
			,tate.T03_KAIDATE
			,tate.T03_TATEMONO_TYPE
			,tate.T03_IDO
			,tate.T03_KEIDO
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_ANNAI_MAP_USE_FLAG
			,COUNT(DISTINCT T03.T03_HEYA_CD) as buken_count

		from
			(
				select
					T03.T03_DAIHYO_TATEMONO_CD
					,min(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as min_chinryo
					,max(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as max_chinryo
					,min(T03.T03_MADORI) as min_madori
					,max(T03.T03_MADORI) as max_madori

				from	T03WEB_HEYA T03 " . $from . "
				where	T03.T03_TODOUFUKEN_CD	IN (" . $prefs . ")";

        // 市区町村条件－－－－－－－－－－－－－－
        // 町条件があれば→カウント
        if (isset($chous) && sizeof($chous) > 0)
        {

            // 単独市区町村がある場合
            if ($cityCds != '')
            {

                $sql .= " AND (";

                $sql .= " T03.T03_SHIKUCHOUSON_CD	IN (" . $cities . ")";
                $sql .= " OR T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";

                $sql .= ") ";
            }
            else
            {
                $sql .= " AND  T03.T03_SHIKUCHOUSON_CD||T03.T03_CHOUMEI_CD IN ('" . implode("','", $chous) . "')";
            }
        }
        else
        { // 町条件がない
            $sql .= " and T03.T03_SHIKUCHOUSON_CD	IN (" . $cities . ")";
        }
        // 市区町村条件－－－－－－－－－－－－－－

        $sql .= " and T03.T03_DAIHYO_FLG = 1 ";
        $sql .= $where . "
						group by T03.T03_DAIHYO_TATEMONO_CD
			) t1

			inner join T03WEB_HEYA T03 on T03.T03_DAIHYO_TATEMONO_CD = t1.T03_DAIHYO_TATEMONO_CD
			inner join T03WEB_HEYA tate on tate.T03_TATEMONO_CD   = t1.T03_DAIHYO_TATEMONO_CD
                         " . $from . "
			where T03.T03_DAIHYO_FLG		=	1
				AND	tate.T03_DAIHYO_FLG		=	1 ";

        $sql .= $where . "
		group by
			min_chinryo
			,max_chinryo
			,min_madori
			,max_madori
			,tate.T03_TENPO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
			,tate.T03_KAIDATE
			,tate.T03_TATEMONO_TYPE
			,tate.T03_IDO
			,tate.T03_KEIDO
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_ANNAI_MAP_USE_FLAG
			,T03.T03_DAIHYO_TATEMONO_CD
		";

        return $this->dbGetList($sql, $dbParams);
    }

    // 市区町村座標取得
    public function getAreaLocation($maptarget)
    {
        $dbParams = array();
        $prefCd = substr($maptarget, 0, 2);
        $cityCd = substr($maptarget, 5, 3);
        $sql = "
				SELECT M84_IDO, M84_KEIDO FROM M84LOCATION_COORD
				WHERE M84_TODOUFUKEN_CD = '" . $prefCd . "' AND M84_SHIKUCHOUSON_CD = '" . $cityCd . "'";
        return $this->dbGetList($sql, $dbParams);
    }

    // 市区町村座標取得
    public function getStationLocation($maptarget)
    {
        $dbParams = array();
        $prefCd = substr($maptarget, 0, 2);
        $stationCd = substr($maptarget, 3);
        $sql = "
				SELECT M03_IDO, M03_KEIDO FROM M03EKI
				WHERE M03_TODOUFUKEN_CD = '" . $prefCd . "' AND M03_EKI_CD = '" . $stationCd . "'";
        return $this->dbGetList($sql, $dbParams);
    }

    // 町域座標取得
    public function getChoumeiLocation($maptarget)
    {
        $dbParams = array();
        $dbParams['prefCd'] = substr($maptarget, 0, 2);
        $dbParams['cityCd'] = substr($maptarget, 5, 3);
        $dbParams['townCd'] = substr($maptarget, 14, 3);
        $sql = "
				SELECT SDO_UTIL.TO_WKTGEOMETRY(M01_LOCATION) AS LOCATION FROM M01JYUUSHO_LOCATION
				WHERE M01_TODOUFUKEN_CD = :prefCd AND M01_SHIKUCHOUSON_CD = :cityCd AND M01_CHOUMEI_CD = :townCd ";
        return $this->dbGetList($sql, $dbParams);
    }

    public function getListForLineMap($prefCds, $stCds, $from, $where, $dbParams)
    {

        // ★★★都道府県
        $preflst = split(" , ", $prefCds);
        $prefVal = [];
        foreach ($preflst as $pref)
        {
            $val = $dbParams[$pref];
            if (!in_array($val, $prefLst))
            {
                $prefVal[] = $val;
            }
            unset($dbParams[$pref]);
        }
        $prefs = "'" . join("','", $prefVal) . "'";
        // ★★★都道府県

        // ★★★市区
        $stlst = split(" , ", $stCds);
        $stVal = [];
        foreach ($stlst as $st)
        {
            $val = $dbParams[$st];
            if (!in_array($val, $stVal))
            {
                $stVal[] = $val;
            }
            unset($dbParams[$st]);
        }
        $sts = "'" . join("','", $stVal) . "'";
        // ★★★市区

        $sql = "
		select
			min_chinryo
			,max_chinryo
			,min_madori
			,max_madori
			,T03.T03_DAIHYO_TATEMONO_CD
			,tate.T03_TENPO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
			,tate.T03_KAIDATE
			,tate.T03_TATEMONO_TYPE
			,tate.T03_IDO
			,tate.T03_KEIDO
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_ANNAI_MAP_USE_FLAG
			,COUNT(DISTINCT T03.T03_HEYA_CD) as buken_count
		from (
				select
					T03.T03_DAIHYO_TATEMONO_CD
					,min(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as min_chinryo
					,max(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as max_chinryo
					,min(T03.T03_MADORI) as min_madori
					,max(T03.T03_MADORI) as max_madori
					from
					(
						select M03_ENSEN_CD, M03_EKI_CD
						from M03EKI
						where M03_RENRAKU_EKI_CD in
							(
								select 	M03_RENRAKU_EKI_CD
								from M03EKI M03
								where M03_EKI_CD in ( " . $sts . " )
							)
						union
						select	M03_ENSEN_CD, M03_EKI_CD
						from	M03EKI M03
						where	M03_EKI_CD in ( " . $sts . " )
					) m03 ,
					T03WEB_HEYA T03 " . $from . "
				where	T03.T03_TODOUFUKEN_CD	IN	(" . $prefs . ")
				and		T03.T03_DAIHYO_FLG		=	1";

        // 駅徒歩が選択されている場合を考慮したSQL文を生成
        $sql .= Rstobi_Model_Common::getEkitohoEkiCondition($dbParams);
        $sql .= $where . "

                group by T03.T03_DAIHYO_TATEMONO_CD
			) t1
			inner join T03WEB_HEYA   T03 on T03.T03_DAIHYO_TATEMONO_CD = t1.T03_DAIHYO_TATEMONO_CD
			inner join T03WEB_HEYA   tate on tate.T03_TATEMONO_CD        = t1.T03_DAIHYO_TATEMONO_CD
                        " . $from . "
			where T03.T03_DAIHYO_FLG		=	1
				and	tate.T03_DAIHYO_FLG		=	1 ";

        $sql .= $where . "
		group by
			min_chinryo
			,max_chinryo
			,min_madori
			,max_madori
			,tate.T03_TENPO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
			,tate.T03_KAIDATE
			,tate.T03_TATEMONO_TYPE
			,tate.T03_IDO
			,tate.T03_KEIDO
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_ANNAI_MAP_USE_FLAG
			,T03.T03_DAIHYO_TATEMONO_CD
		";

        return $this->dbGetList($sql, $dbParams);
    }

    public function getListForShopMap($shopCd, $from, $where, $dbParams)
    {
        $sql = "
		select
			min_chinryo
			,max_chinryo
			,min_madori
			,max_madori
			,T03.T03_DAIHYO_TATEMONO_CD
			,tate.T03_TENPO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
			,tate.T03_KAIDATE
			,tate.T03_TATEMONO_TYPE
			,tate.T03_IDO
			,tate.T03_KEIDO
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_ANNAI_MAP_USE_FLAG
			,COUNT(DISTINCT T03.T03_HEYA_CD) as buken_count
		from
			(
				select
					T03.T03_DAIHYO_TATEMONO_CD
					,min(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as min_chinryo
					,max(T03.T03_YACHIN_KANRI_KYOEKI_SUM) as max_chinryo
					,min(T03.T03_MADORI) as min_madori
					,max(T03.T03_MADORI) as max_madori
				from	T03WEB_HEYA T03 " . $from . "
				where	T03.T03_TENPO_CD	IN ('" . $shopCd . "') " . $where . "
				group by
					T03.T03_DAIHYO_TATEMONO_CD

			) t1
			inner join T03WEB_HEYA T03 on T03.T03_DAIHYO_TATEMONO_CD = t1.T03_DAIHYO_TATEMONO_CD
			inner join T03WEB_HEYA tate on tate.T03_TATEMONO_CD        = t1.T03_DAIHYO_TATEMONO_CD
                         " . $from . "
		where 1		=	1 ";

        $sql .= $where . "
		group by
			min_chinryo
			,max_chinryo
			,min_madori
			,max_madori
			,tate.T03_TENPO_CD
			,tate.T03_TATEMONO_NAME
			,tate.T03_TATEMONO_NAME_KOUKAI
			,tate.T03_JYUUSHO_TEXT
		    ,tate.T03_BANCHI
			,tate.T03_KAIDATE
			,tate.T03_TATEMONO_TYPE
			,tate.T03_IDO
			,tate.T03_KEIDO
			,tate.T03_GAIKAN_GAZOU01
			,tate.T03_ANNAI_MAP_USE_FLAG
			,T03.T03_DAIHYO_TATEMONO_CD

";

        return $this->dbGetList($sql, $dbParams);
    }

    /**
     * 住所説明文マスタ（全国）を取得
     * @param unknown $pref_cd
     * @param unknown $city_Cd
     * @return データベースの出力結果
     */
    public function getCityInfo($pref_cd, $city_Cd)
    {
        // SQL生成
        $sql = <<< DOC_END
SELECT
    M01_SEO_TEXT_TOP
   ,M01_SEO_TITLE_BOTTOM_1
   ,M01_SEO_TEXT_BOTTOM_1
   ,M01_SEO_TITLE_BOTTOM_2
   ,M01_SEO_TEXT_BOTTOM_2
FROM
    M01JYUUSHO_SETSUMEI
WHERE
        M01_TODOUFUKEN_CD = :pref_cd
    AND M01_SHIKUCHOUSON_CD = :city_cd
DOC_END;

        $db_params = array();
        $db_params[':pref_cd'] = $pref_cd;
        $db_params[':city_cd'] = $city_Cd;

        return $this->dbGetData($sql, $db_params);
    }

    /**
     * 駅説明文マスタを取得
     * @param unknown $station_cd
     * @return データベースの出力結果
     */
    public function getStationInfo($station_cd)
    {
        // SQL生成
        $sql = <<< DOC_END
SELECT
    M03_SEO_TEXT_TOP
   ,M03_SEO_TITLE_BOTTOM_1
   ,M03_SEO_TEXT_BOTTOM_1
   ,M03_SEO_TITLE_BOTTOM_2
   ,M03_SEO_TEXT_BOTTOM_2
FROM
    M03EKI_SETSUMEI
WHERE
    M03_EKI_CD = :station_cd
DOC_END;

        $db_params = array();
        $db_params[':station_cd'] = $station_cd;

        return $this->dbGetData($sql, $db_params);
    }
}
